package com.example.demo.module.event;

import org.springframework.context.ApplicationListener;
import org.springframework.context.event.EventListener;

/**
 * @author lufei
 * @version 1.0
 * @created 18-6-15
 */
public class MyEventListener implements ApplicationListener<MyEvent> {
    @Override
    public void onApplicationEvent(MyEvent myEvent) {
        System.out.println(myEvent.getTimestamp());
    }

    @EventListener(condition = "#event.age==1")
    public void onApplicationCustomerEvent(MyEvent event) {
        System.out.println(event.getTimestamp());
    }
}
